<!doctype html>
<html>

	<head>
		<meta charset="utf-8">
		<title>无标题文档</title>
		<script type="text/javascript" src="js/jquery.min.js"></script>
		<script src="static/layui/lay/modules/layer.js" type="text/javascript"></script>
		<script type="text/javascript" src="./js/xadmin.js"></script>
		<link rel="stylesheet" href="static/layui/css/layui.css" media="all" />
		<link rel="stylesheet" href="static/layui/css/modules/layer/default/layer.css" />

		 <link rel="stylesheet" type="text/css" href="http://www.jq22.com/jquery/bootstrap-3.3.4.css"> 
		<link href="dist/bootstrap-3.3.4.css" rel="stylesheet" />
		<link href="dist/summernote.css" rel="stylesheet" />
		 
		 <script src="http://www.jq22.com/jquery/bootstrap-3.3.4.js"></script>
		<script src="dist/bootstrap-3.3.4.js"></script>
		<script src="dist/summernote.js"></script>
		<script src="dist/lang/summernote-zh-CN.js"></script>    <!-- 中文-->

		<style>   
			.m {
				width: 800px;
			}
		</style>
		<script>
			$(function() {
				$('.summernote').summernote({
					height: 200,
					tabsize: 2,
					lang: 'zh-CN'
				});	
			});	
		</script>
		<script>
			$(function() {
            	$("#div1").hide();
				$("#btn").click(function() {
					var content = $('.summernote').summernote('code');
					var title = $("#title").val();
					var type = $("#type").val();
					var email = document.getElementById("em").innerHTML;
					var sendTime = document.getElementById("sendTime").value;
					alert(email + ":" + title + ":" + content + ":" + type + ":" + sendTime);
					var params = {
						"title": title,
						"content": content,
						"type": type,
						"email": email,
						"sendTime": sendTime,
					}
					$.ajax({
						type: "post",
						url: "http://localhost:9095/admin/edu/save",
						data: params,
						headers: {
						"token2": $.cookie("token2")
					},
						dataType: 'json',
						success: function() {
							alert("请求成功");
						},
						error: function(result) {
							alert("error");
						}
					})
				});				
			});
			function changeTime(obj) {
					if($(obj).val() == '2') {
						$("#div1").show();
					} else {
						$("#div1").hide();
					}
				}
		</script>
	</head>

	<body>
		<form id="form1">
			联系人 :

			<span id="em"></span>
			<a href="#" onclick="xadmin.open('添加联系人','sysUser_select.html')">添加联系人</a>

			<br />

			   
			标题： 
			<input type="text" id="title" name="title" placeholder="请输入标题"  > 
			<br />
			<!--	</div>
			</div>--> 
			正文内容:

			<div class="m">

				<div class="summernote" id="content"> </div>
			</div>
			<br />
			 邮件类型:
		 
				<select name="type" id="type" onchange="changeTime(this)">
					<option value="1">正常</option>
					<option value="2">定时</option>
				</select>
			 
			<br />
			 	<div id="div1">
			定时时间:<input type="date" name="sendTime" id="sendTime" />
               </div> 
               		 
			<input type="button" value="提交" id="btn"  class="layui-btn"/>

		</form>

	</body>

</html>